<template>
	<view class="padding-top-lg">
		<view class="text-center padding-lg text-bold text-xl ">
			您的信息已经发布成功！
		</view>
		<view class="text-lg padding-lg flex">
			<view class="flex-twice text-center">
				加客服微信：
				<text class="padding-left-xs">{{ wx }}</text>
			</view>
			<view class="flex-sub text-center">
				<text @tap="copy" data-clipboard-action="copy" :data-clipboard-text="wx" class="copy-btn text-green">复制</text>
			</view>
		</view>

		<view class="bg-gradual-yellow margin">
			<view class="text-center padding-top text-xl text-bold">
				会员招聘特权
			</view>
			<view class="padding">
				开通会员招聘特权功能，您的招聘信息将急聘到列表首页，并且客服会进行线下1000驾驶员群推送，帮助更快招到人。
			</view>
			<view class="padding">
				<button class="bg-black" @tap="showModal = true">立即开通</button>
			</view>
			<view class="padding-bottom text-center">
				<text @tap="noneed">暂不需要</text> 
			</view>
		</view>
		<member :id="ancId" :showModal="showModal" @close="showModal = false" />
	</view>
</template>

<script>
	import Clipboard from 'clipboard'
	import member from '../../components/member.vue'
	export default {
		data() {
			return {
				showModal: false,
				wx: 'zubajie_',
				ancId: null
			};
		},
		onLoad(options) {
			this.ancId = options.ancId
			this.getConfig();
		},
		onShow() {},
		onUnload() {
			this.noneed()
		},
		components: {
			member
		},
		methods: {
			getConfig(){
				let config = uni.getStorageSync('config')
				if(config){
					this.wx = config.find(v=>v.parmName=='h5_wechat_pub_success').value
				}
			},
			noneed(){
				uni.reLaunch({
					url: '/pages/pub/pub'
				})
			},
			copy(){
				let _this = this;
				let clipboard = new Clipboard(".copy-btn");
				clipboard.on('success', function() {
					uni.showToast({
						title: '复制成功'
					})
				});
				clipboard.on('error', function() {
					setTimeout(()=>{
						uni.showToast({
							title: '复制失败',
							icon: 'none'
						})
					}, 500);
				});
			}
		}
	}
</script>